package org.edith.shiro.service.impl;

import org.edith.shiro.dao.SysRoleDAO;
import org.edith.shiro.dataobject.SysRoleDO;
import org.edith.shiro.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 *  角色业务实现
 */
@Service("edithSysRoleService")
public class SysRoleServiceImpl implements SysRoleService {
    @Autowired
    private SysRoleDAO sysRoleDAO;
    @PostConstruct
    private void createTable(){
        sysRoleDAO.createTable();
    }
    /**
     * 通过用户ID查询角色集合
     *
     * @param userId 用户ID
     * @return List<SysRoleDO> 角色名集合
     */
    @Override
    public List<SysRoleDO> selectSysRoleByUserId(Long userId) {
        return this.sysRoleDAO.selectSysRoleByUserId(userId);
    }
}